<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function Hero(name) {
            this.name = name;
        }
        function change(x) {
            console.log(x.name); //第二个输出 虞姬
            x.name = '貂蝉';
            console.log(x.name); //第3个输出 貂蝉
        }
        var yuji = new Hero('虞姬');
        console.log(yuji.name); //第1个输出 貂蝉
        change(yuji);
        console.log(yuji.name); //第四输出 虞姬
    </script>
</body>

</html>